package com.feicheng.controller.wx;


import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.service.IAroomService;
import com.feicheng.persistence.service.IAroomyyjlService;
import com.feicheng.service.a.FYyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/wx/yy")
@RestController("/wx/yy")
public class YyController {

    @Autowired
    FYyService yyService;

    @Autowired
    IAroomService roomService;

    @Autowired
    IAroomyyjlService roomyyjlService;

    @PostMapping("/range/daily")
    public ResultInfo getRangeDaily(@RequestBody JSONObject param) {
        param = yyService.getYyjlByDaily(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/range/date")
    public ResultInfo getRangeDate(@RequestBody JSONObject param) {
        param = yyService.getYyjlByRangeDate(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/info")
    public ResultInfo newYy(@RequestBody JSONObject param) {

        param = yyService.newYyjl(param);

        return ResultInfo.success(param);
    }

    @PostMapping("/cancel")
    public ResultInfo cancelYy(@RequestBody JSONObject param) {
        param = yyService.cancel(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/item")
    public ResultInfo getItems(@RequestBody JSONObject param) {
        param = yyService.getYyjlItem(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/info/get")
    public ResultInfo getYyjlDetail(@RequestBody JSONObject param) {
        param = yyService.getYyjl(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/page")
    public ResultInfo getYyByPage(@RequestBody JSONObject param) {
        param = yyService.getYyjlByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/info/put")
    public ResultInfo updateYyjlDetail(@RequestBody JSONObject param) {
        param = yyService.updateYyjl(param);
        return ResultInfo.success(param);
    }
}
